package com.group.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.group.pojo.TbBill;
import com.group.pojo.TbRepair;
import com.group.service.RepairService;

@Controller
@RequestMapping("/repair")
public class RepairController {
	@Autowired
	private RepairService repairService;

	// 跳转维修师接单视图
	@RequestMapping("/grab.action")
	public String grab() {
		return "repair/grab";
	}

	// 跳转维修任务视图
	@RequestMapping("/task.action")
	public String tash() {
		return "repair/task";
	}
	
	// 维修一览
	@RequestMapping("/view.action")
	public String view() {
		return "repair/view";
	}
	
	@RequestMapping("/query.action")
	@ResponseBody
	public List<TbRepair> query(TbRepair repair) {
		List<TbRepair> list = repairService.query(repair);
		return list;
	}


	//抢单
	@RequestMapping("/grabSave.action")
	@ResponseBody
	public Map<String, String> grabSave(TbRepair repair,HttpServletRequest request) {
		Map<String, String> map = repairService.grabSave(repair,request);
		return map;
	}

	@RequestMapping("/taskQuery.action")
	@ResponseBody
	public List<TbBill> taskQuery(HttpServletRequest request) {
		List<TbBill> list = repairService.taskQuery(request);
		return list;
	}
	
	@RequestMapping("/viewQuery.action")
	@ResponseBody
	public List<TbBill> viewQuery(HttpServletRequest request) {
		List<TbBill> list = repairService.viewQuery(request);
		return list;
	}
	
	//抢单
	@RequestMapping("/taskSave.action")
	@ResponseBody
	public Map<String, String> taskSave(TbRepair repair,HttpServletRequest request) {
		Map<String, String> map = repairService.taskSave(repair, request);
		return map;
	}
}
